<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>关注用户</title>
  <link href="css/bootstrap-combined.min.css" rel="stylesheet">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <script src="js/pagination.js"></script>

  <style type="text/css">
	.pageTop {
		width: 100%;
		height: 45px;
		line-height: 45px;
		background-color: #f2f2f2;
	}

	.page {
		width: 96%;
		margin: 30px auto;
	}

	.page table tr td {
		text-align: center;
		border: 1px solid #dcdbdb;
		height: 40px;
	}

	.page table tr th {
		text-align: center;
		border: 1px solid #dcdbdb;
		background-color: #f2f2f2;
		color: #438eb9;
		height: 40px;
	}

	.pageFoot {
		text-align: center;
		cursor: pointer;
	}
	
	.find {
		width: 80px;
		height: 33px;
		border: none;
		font-size: 20px;
		color: #fff;
		background-color: #47a4e1;
		border-radius: 7px;
	}
  </style>
 </head>
 <body>
   <div>
		<div class="pageTop">
			<span style="color: #3695cc; padding-left: 30px; cursor: pointer;">关注用户</span>
		</div>
		<!-- 查询关注用户开始 -->
		<div style="margin: 30px 26px;">
			<form action="attention_user.php" method="GET">
				<span>用户昵称&nbsp;&nbsp;</span><input id="nickName" name="nickName" value="<?php if(!empty($_GET["nickName"])) {echo $_GET["nickName"]; } ?>" placeholder="昵称" style="width: 120px; height: 30px;" />
				<button type="submit" class="find">查询</button>
			</form>
		</div>
		<!-- 查询关注用户结束 -->
		<div class="page">
			<table align="center" border="1" cellspacing="0" cellpadding="0" style="width: 100%; border: 1px solid #dcdbdb;">
				<thead>
				  <tr>
					 <th style="width: 5%;">序号</th>
					 <th style="width: 8%;">用户头像</th>
					 <th style="width: 8%;">用户昵称</th>
					 <th style="width: 10%;">用户性别</th>
					 <th style="width: 10%;">用户所在城市</th>
					 <th style="width: 10%;">用户所在省份</th>
					 <th style="width: 8%;">是否关注</th>
					 <th style="width: 20%;">关注时间</th>
				  </tr>
			   </thead>
			   <tbody>
				  <?php
						require("APP_ROOT.php");
						require(__ROOT__."/class/mysqlpdo.class.php");
						require_once(__ROOT__."/config/constant.config.php");
						require_once(__ROOT__."/page.php");
						//获取请求参数 页数
						$page = 1;
						$nickName = "";
						$param = array();
						if(!empty($_GET["page"])) {
							$page = $_GET["page"];
						}
						if(!empty($_GET["nickName"])) {
							$nickName = $_GET["nickName"];
							$param["nick_name"] = $nickName;
						}
						//var_dump($page);
						//查询数据
						$pdo = new mysqlpdo();
						$totalCount = $pdo -> fetch("t_subscribe_user", "COUNT(1)", $param);
						//总记录数
						$totalRecord = intval($totalCount["COUNT(1)"]);
						//计算总页数
						$totalPages = getTotalPages($totalRecord);
						$result = $pdo -> fetchPagination("t_subscribe_user", "*", $param, $page);
						if(!empty($result) && count($result) > 0) {
							foreach($result as $obj) {
					?>
								<tr>
								 <td><?php echo $obj["id"] ?></td>
								 <td style="cursor: pointer;">
									<?php if(!empty($obj["headimg_url"])) { ?><img src="<?php echo $obj["headimg_url"] ?>" style="width: 50px; height:33px;" /><?php } ?>
								</td>
								 <td><?php echo $obj["nick_name"] ?></td>
								 <td><?php if(intval($obj["sex"]) == 1) {echo "男";} else if(intval($obj["sex"]) == 2) {echo "女";} else {echo "未知";} ?></td>
								 <td><?php echo $obj["city"] ?></td>
								 <td><?php echo $obj["province"] ?></td>
								 <td><?php if(intval($obj["subscribe"]) == 1) {echo "是";} else {echo "否";} ?></td>
								 <td><?php echo date("Y-m-d H:i:s", $obj["subscribe_time"]) ?></td>
							  </tr>
					<?php	
							}
						}
					if($totalPages > 1) {
						//分页
						echo "<script type='text/javascript'>$(function() { pagination($page, $totalPages, 'attention_user.php'); });</script>";
					}
				   ?>
			   </tbody>
			</table>
		<div>
		<!-- 分页 -->
		<div class="pageFoot">
			<div id="pagination"></div>
		</div>
   </div>	
	
 </body>
</html>
